import { BufferGeometry3D, Vector3 } from 'feng3d-three';
import { ParametricGeometry } from '../thirdparty/three/imports';

export class ParametricGeometry3D extends BufferGeometry3D
{
    get _geometry()
    {
        if (!this.__geometry)
        {
            this.__geometry = new ParametricGeometry(this.func, this.slices, this.stacks);
        }

        return this.__geometry;
    }
    declare protected __geometry: ParametricGeometry;

    func?: (u: number, v: number, target: Vector3) => void;

    slices?: number;

    stacks?: number;

    constructor(func?: (u: number, v: number, target: Vector3) => void, slices?: number, stacks?: number)
    {
        super();
        this.func = func;
        this.slices = slices;
        this.stacks = stacks;
    }
}
